(function(KKBus){

    function BusController() {
        var self = this;
        
        self.bus = ko.observableArray();
        
        self.getBus = function (page)
        {
           
            
            app.request++;
        
             var url = 'rest/busses/';
                               
           
        
        
        KKBus.Ajax.doGet(url, function(data, textStatus, jqXHR)
        {
      
        var jsData = JSON.parse(data);
        var i = jsData.length;
        
        
            while(i--){
                 self.bus.push(new KKBus.BusModel(jsData[i].id,jsData[i].brand, jsData[i].registartion )); 
         }
         app.request--;
                  
          if (app.request == 0) {
                    if (app.settings.DEBUG == true) { console.log("Load template from: " + BusController.name); }
                    setTimeout(function() { app.loadTemplate(); }, 1000);
                }
            });
        };
        
       
        
    }
   

    KKBus. BusController =  BusController;
    
}(window.KKBus));

